﻿using System;
using System.Collections.Generic;
using System.Data;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Module.BusinessLogic;

namespace Web
{
    public partial class Game : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                LoadData();
            }
            catch (Exception)
            {                                
            }
        }
        void LoadData()
        {
            DataTable dt;
            dt = new DataTable();
            dt = CMSGameBL.GetTop();
            if (dt != null && dt.Rows.Count > 0)
            {
                rptData.DataSource = dt;
                rptData.ItemDataBound += new RepeaterItemEventHandler(rptData_ItemDataBound);
                rptData.DataBind();

            }
        }
        void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Label lbtitle = (Label)e.Item.FindControl("lbtitle");
            DataRowView dr = (DataRowView)e.Item.DataItem;
            if (dr["NameGame"].ToString().Length > 15)
            {
                lbtitle.Text = dr["NameGame"].ToString().Substring(0, 15) + " ...";
            }
            else
            {
                lbtitle.Text = dr["NameGame"].ToString();
            }
        }
    }
}